<!--
 * @Author: hq
 * @Date: 2022-05-18 19:57:54
 * @LastEditors: hq
 * @LastEditTime: 2022-05-26 11:27:57
 * @Description: 角色管理
 * @version: 1.0
-->
<template>
  <div class="info">
    <div class="card_con mb15">
      <el-row>
        <el-col :span="6" class="pr40">
          <div class="fz14 mb15">状态</div>
          <el-select v-model="state" placeholder="请选择">
            <el-option
              v-for="item in stateData"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            >
            </el-option>
          </el-select>
        </el-col>
        <el-col :span="6" class="pr40">
          <div class="fz14 mb15">身份昵称</div>
          <el-input v-model="nickname" placeholder="请输入身份昵称"></el-input>
        </el-col>
        <el-col :span="6">
          <div class="fz14 mb15">&nbsp;</div>
          <el-button type="primary">查询</el-button>
        </el-col>
      </el-row>
    </div>
    <div class="card_con">
      <div class="row mb20">
        <div class="l" @click="handleAdd">
          <i class="el-icon-circle-plus-outline"></i>添加身份
        </div>
      </div>
      <el-table
        border
        :data="tableData"
        class="midle_tb"
        :header-cell-style="{
          'text-align': 'center',
        }"
        :cell-style="{ 'text-align': 'center' }"
        stripe
        style="width: 100%"
        highlight-current-row
      >
        <el-table-column prop="id" label="id" min-width="5%"> </el-table-column>
        <el-table-column prop="location" label="身份昵称" min-width="20%">
        </el-table-column>
        <el-table-column prop="location" label="权限" min-width="20%">
        </el-table-column>
        <el-table-column prop="status" label="状态" min-width="10%">
          <template slot-scope="scope">
            <el-switch
              class="tablescope"
              v-model="scope.row.status"
              :active-color="$color - primary1"
              inactive-color=""
            >
            </el-switch>
          </template>
        </el-table-column>
        <el-table-column label="操作" min-width="20%">
          <template slot-scope="scope">
            <div class="caozuo">
              <div
                class="handleEdit hand_cs"
                @click="handleEdit(scope.$index, scope.row)"
              >
                修改
              </div>
              <div
                class="handleDelete hand_cs"
                @click="handleDelete(scope.$index, scope.row)"
              >
                删除
              </div>
            </div>
          </template>
        </el-table-column>
      </el-table>
      <div class="pagination">
        <Pagination
          :page="page"
          @onCurrentChange="handleCurrentChange"
          @onSizeChange="handleSizeChange"
        />
      </div>
    </div>
    <el-dialog title="添加身份" :visible.sync="addlog" width="600px">
      <EditDialog v-if="addlog" @handleClose="handleClose"></EditDialog>
    </el-dialog>
    <el-dialog title="编辑身份" :visible.sync="editlog" width="600px">
      <EditDialog v-if="editlog" @handleClose="handleClose"></EditDialog>
    </el-dialog>
  </div>
</template>

<script>
import EditDialog from "../system/manage/role_edit.vue";
import Pagination from "@/components/Pagination.vue";
export default {
  components: { Pagination, EditDialog },
  data() {
    return {
      shopName: "",
      time: "",
      tableData: [
        {
          id: "23",
          hf_id: "123243",
          tel: "18582669937",
          location: "成都市武侯区",
          logo: require("@/assets/1.png"),
          leixing: "入驻",
          status: "启用",
          create_time: "2022-5-19",
        },
        {
          id: "23",
          hf_id: "123243",
          tel: "18582669937",
          location: "成都市武侯区",
          logo: require("@/assets/1.png"),
          leixing: "入驻",
          status: "启用",
          create_time: "2022-5-19",
        },
        {
          id: "23",
          hf_id: "123243",
          tel: "18582669937",
          location: "成都市武侯区",
          logo: require("@/assets/1.png"),
          leixing: "入驻",
          status: "启用",
          create_time: "2022-5-19",
        },
        {
          id: "23",
          hf_id: "123243",
          tel: "18582669937",
          location: "成都市武侯区",
          logo: require("@/assets/1.png"),
          leixing: "入驻",
          status: "启用",
          create_time: "2022-5-19",
        },
        {
          id: "23",
          hf_id: "123243",
          tel: "18582669937",
          location: "成都市武侯区",
          logo: require("@/assets/1.png"),
          leixing: "入驻",
          status: "启用",
          create_time: "2022-5-19",
        },
        {
          id: "23",
          hf_id: "123243",
          tel: "18582669937",
          location: "成都市武侯区",
          logo: require("@/assets/1.png"),
          leixing: "入驻",
          status: "启用",
          create_time: "2022-5-19",
        },
      ],
      stateData: [
        {
          id: "1",
          name: "显示",
        },
        {
          id: "2",
          name: "隐藏",
        },
      ],
      state: "",
      page: {
        total: 0,
        pageNum: 1, // 当前页数
        pageSize: 10, // 每页的条数
      },
      editlog: false,
      addlog: false,
    };
  },
  methods: {
    //新增
    handleAdd() {
      this.addlog = true;
    },
    //编辑
    handleEdit() {
      this.editlog = true;
    },
    //删除
    handleDelete() {},
    handleClose() {
      this.editlog = false;
      this.addlog = false;
    },

    // 每页 ${val} 条
    handleSizeChange(val) {
      //   this.$emit("onSizeChange", val);
    },
    // 当前页: ${val}
    handleCurrentChange(val) {
      //   this.$emit("onCurrentChange", val);
    },
  },
};
</script>

<style lang="scss" scoped>
.row {
  display: flex;
  justify-content: center;
  border-radius: 2px;
  border: 1px solid #ccc;
  width: 100px;
  .l {
    width: 80px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;

    i {
      margin-right: 6px;
      font-size: 18px;
    }
    &:hover {
      cursor: pointer;
    }
  }
  .l:nth-child(3) {
    border-right: 0;
  }
}

.info {
  .title {
    font-size: 16px;
    margin-bottom: 13px;
  }
  .tab {
    background-color: #fff;
    padding: 20px;
    box-sizing: border-box;
  }
}
.tab {
  background-color: #fff;
  padding: 20px;
  box-sizing: border-box;
  .el-input {
    width: 20%;
    margin-right: 20px;
  }
  .el-button {
    margin-left: 20px;
  }
}

/deep/.el-breadcrumb__inner {
  cursor: pointer !important;
}
.marl {
  padding-left: 2px;
}
.midle_tb {
  margin-top: 20px;
}
/deep/.el-date-editor {
  width: 100%;
}
.el-select {
  width: 100%;
}
.caozuo {
  display: flex;
  justify-content: center;
  .handleDelete {
    margin-left: 20px;
  }
}
/deep/.el-dialog {
  height: 75%;
  .el-dialog__body {
    height: 77%;
    overflow: auto;
  }
}
</style>
